<div class="col-xs-12" style="height: 100%">
	<div class="form-group">
		<div class="input-group">
			<div class="input-group-addon">组织名称:</div>
			<select id="orgName" class="form-control">
				<option value="-1">请选择</option>
			</select>
		</div>
	</div>
</div>
<script type="text/javascript">
	init();
	function init() {
		Dialog.saveBtn.on("click",allotSaveTerm);
		callSvr("OrgManage/getOrgListByPid",{"type":-1}, function(result) {
			for (var i = 0; i < result.length; i++) {
				$("#orgName").append("<option value='"+result[i].OrgId+"'>" + result[i].Name+ "</option>");
			}
		});
	}
	function allotSaveTerm() {
		var _orgId = $("#orgName").val();
		if (_orgId == "-1") {
			alert("请选择下属组织!");
		} else {
			var isoperation = confirm("您确定将以下终端:" + em.termCode + "下发到"
					+ $("#orgName").find("option[value=" + _orgId + "]").html()
					+ "?");
			if (isoperation) {
				var para = {
					"orgId" : _orgId,
					"termCode" : em.termCode,
					"orgName" : $("#orgName").find("option[value=" + _orgId + "]").html()
				};
				callSvr("termManage/allotTerm", para, function(result) {
					if (result.err == 0) {
						toastr.success('下发成功', '');
						Dialog.exitBtn.click();
						showTermList();
					} else {
						toastr.error('下发失败,服务器内部错误', '');
					}

				});
			}
		}
	}
</script>